import MySQLdb as db;
conn = db.connect(host='ensembldb.ensembl.org',user='anonymous')

c = conn.cursor()

# 统计ensembl 数据库有多少物种？
c.execute('show databases')
r = c.fetchall()

di = {}
for d in r:
    n = d[0]
    k = '_'.join(n.split('_')[:2])
    if di.has_key(k):di[k] = di[k] + 1
    else:
        di[k] =1

